<div class="x-body">
    <form class="layui-form layui-form-pane" id="AdminRoleAdd" lay-filter="AdminRoleAdd">
        <input type="hidden" name="layerindex" id="layerindex" value="">
        <div class="layui-form-item">
            <label for="name" class="layui-form-label">
                        <span class="x-red">*</span>角色名
                    </label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="title" required="" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text" style="height:400px;overflow:scroll">
            <label class="layui-form-label">拥有权限 </label>
            <table class="layui-table layui-input-block site-table">
                <tbody>
                    <volist name="nodelist" id="vo">
                        <tr>
                            <td width="100"> <input name="nodeid[]" type="checkbox" value="{$vo.id}">{$vo.title}</td>
                            <td>
                                <table class="layui-table layui-input-block site-table">
                                    <tbody>
                                        <volist name="vo['child']" id="ch">
                                            <tr>
                                                <td width="120"><input name="nodeid[]" type="checkbox" value="{$ch.id}">{$ch.title}</td>
                                                <td>
                                                    <div class="layui-input-block">
                                                        <volist name="ch['child']" id="child">
                                                            <input name="nodeid[]" type="checkbox" value="{$child.id}"> {$child.title}
                                                        </volist>
                                                    </div>
                                                </td>
                                            </tr>
                                        </volist>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
        </div>
        <div class="layui-form-item layui-form-text">
            <label for="desc" class="layui-form-label">
                        描述
                    </label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="desc" name="remark" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" lay-filter="add">增加</button>
        </div>
    </form>
</div>
<script>
    form.render(null, 'AdminRoleAdd');
    form.on('submit(add)', function(data) {
        $.ajax({
            url: '{:U("Role/add")}',
            type: "post",
            data: data.field,
            dataType: 'json',
            success: function(r) {
                layer.msg(r.info);
                if (r.status) {
                    layer.close($('#layerindex').val());
                    table.reload('AdminRoleDt');
                }
            }
        });
        return false;
    });
</script>